﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>健康上报</title>
    <link rel="stylesheet" href="../../../assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="../../../assets/module/admin.css?v=317"/>
    <style>
        .layui-table-cell {
            height: 50px !important;
        }
    </style>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>

    <![endif]-->
</head>
<body>
<!-- 页面加载loading -->
<div class="page-loading">
    <div class="ball-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!-- 表格工具栏 -->
            <form class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">上报时间:</label>
                        <div class="layui-input-inline">
                            <input name="date" class="layui-input" autocomplete="off" placeholder="输入访问日期" id="date"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">上报人姓名:</label>
                        <div class="layui-input-inline">
                            <input name="name" class="layui-input" autocomplete="off" placeholder="请输入姓名"/>
                        </div>
                    </div>
                    <div class="layui-inline">&emsp;
                        <button class="layui-btn icon-btn" lay-filter="roleTbSearch" lay-submit>
                            <i class="layui-icon">&#xe615;</i>搜索
                        </button>
                    </div>
                </div>
            </form>
            <!-- 数据表格 -->
            <table id="roleTable" lay-filter="roleTable"></table>
        </div>
    </div>
</div>

<!-- 表格操作列 -->
<script type="text/html" id="roleTbBar">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">查看</a>
</script>
<!-- 表单弹窗 -->
<script type="text/html" id="roleEditDialog">
    <form id="roleEditForm" lay-filter="roleEditForm" class="layui-form model-form">
        <input name="adviceId" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">姓名:</label>
            <div class="layui-input-block">
                <input name="trueName" placeholder="请输入角色名" class="layui-input"
                       lay-verType="tips" lay-verify="required" required readonly/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">建议:</label>
            <div class="layui-input-block">
                <textarea name="advice" placeholder="请输入备注" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结果:</label>
            <div class="layui-input-block">
                <select name="status">
                    <option value="1" selected>同意</option>
                    <option value="0">不同意</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">反馈:</label>
            <div class="layui-input-block">
                <textarea name="backWords" placeholder="请输入备注" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn" lay-filter="roleEditSubmit" lay-submit>保存</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </form>
</script>
<!-- js部分 -->
<script type="text/javascript" src="../../../assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="../../../assets/js/common.js?v=317"></script>
<script type="text/javascript" src="../../../assets/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../../../assets/js/js.cookie.min.js"></script>
<script type="text/javascript" src="../../../assets/js/sqjx.js"></script>
<script>
    layui.use(['layer', 'laydate','form', 'table', 'util', 'admin', 'zTree','flow'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var admin = layui.admin;
        var laydate = layui.laydate;
layui.flow.lazyimg();
        laydate.render({
            elem: '#date', //指定元素
            trigger:'click'
        });
        /* 渲染表格 */
        var insTb = table.render({
            elem: '#roleTable',
            url: '/office/health/queryHealthList',
            page: true,
            method: 'post',
            request: {
                pageName: 'page',
                limitName: 'rows',
            },
            cellMinWidth: 100,
            height: $(window).height() - 100,
            toolbar: ['<p>',
                '<button lay-event="export" class="layui-btn layui-btn-sm icon-btn"><i class="layui-icon">&#xe67d;</i>导出excel</button>&nbsp;',
                '<button lay-event="exportZip" class="layui-btn layui-btn-sm icon-btn"><i class="layui-icon">&#xe67d;</i>导出图片</button>&nbsp;',
                '</p>'].join(''),
            cols: [[
                {type: 'numbers'},
                {field: 'crtDate', title: '上报日期', width: '120', templet: function (row) {
                        return row.crtDate
                    }},
                {
                    field: 'healthImg', title: '健康码', width: '100', templet: function (row) {
                        return `<image alt="加载中..." style="width: 50px;height: 50px" src="${row.healthImg}?token=${Cookies.get('token')}"></image>`
                    }
                },
                {
                    field: 'travelImg', title: '行程码', width: '100', templet: function (row) {
                        return `<image alt="加载中..." style="width: 50px;height: 50px" src="${row.travelImg}?token=${Cookies.get('token')}"></image>`
                    }
                },
                {
                    field: 'acidImg', title: '核酸', width: '100', templet: function (row) {
                        if(!row.acidImg){
                            return '无'
                        }
                        return `<image alt="加载中..." style="width: 50px;height: 50px" src="${row.acidImg}?token=${Cookies.get('token')}"></image>`
                    }
                },
                {field: 'name', title: '姓名', width: '100'},
                {field: 'account', title: '工号', width: '100'},
                {field: 'temperature', title: '温度', width: '100'},
                {field: 'orgName', title: '部门', width: '100'},
                {field: 'idNum', title: '身份证', width: '180'},
                {
                    field: 'isSick', title: '是否接触发热咳嗽人群', width: '100', templet: function (row) {
                        return row.isSick == 1 ? '是' : '否'
                    }
                },
                {
                    field: 'isSafe', title: '是否发热咳嗽', width: '100', templet: function (row) {
                        return row.isSafe == 1 ? '是' : '否'
                    }
                },
                {field: 'fromPlace', title: '来到宿迁地址', width: '200'},
                {field: 'livePlace', title: '居住地址', width: '200'},
                {field: 'comment', title: '备注', width: '200'},

            ]],
            parseData: function (res) {
                res = res.obj;
                return {
                    "code": 0,
                    "msg": "",
                    "count": res.total,
                    "data": res.rows
                }
            },
            done:function(res,curr,count){
                hoverOpenImg();//显示大图
                $('table tr').on('click',function(){
                    $('table tr').css('background','');
                    $(this).css('background','<%=PropKit.use("config.properties").get("table_color")%>');
                });
            }
        });

        /* 表格搜索 */
        form.on('submit(roleTbSearch)', function (data) {
            insTb.reload({where: data.field, page: {curr: 1}});
            return false;
        });

        /* 表格头工具栏点击事件 */
        table.on('toolbar(roleTable)', function (obj) {
            if (obj.event === 'export') { // 添加
                var date = $("[name='date']").val()
                showExport(date);
            }else if (obj.event ==='exportZip'){
                var date = $("[name='date']").val()
                exportZip(date);
            }
        });

        function hoverOpenImg(){
            var img_show = null; // tips提示
            $('td img').hover(function(){
                var kd=$(this).width();
                kd1=kd*3;          //图片放大倍数
                kd2=kd*3+30;       //图片放大倍数
                var img = "<img class='img_msg' src='"+$(this).attr('src')+"' style='width:"+kd1+"px;' />";
                img_show = layer.tips(img, this,{
                    tips:[2, 'rgba(41,41,41,.5)']
                    ,area: [kd2+'px']
                });
            },function(){
                layer.close(img_show);
            });
            $('td img').attr('style','max-width:70px;display:block!important');
        }
        function showExport(date) {
            if(!date){
                showAlert('请输入上报时间并导出!')
                return false
            }
            window.location = BASE_URL + '/office/health/export?token=' + Cookies.get('token') + '&date=' + date;
        }
        function exportZip(date) {
            if(!date){
                showAlert('请输入上报时间并导出!')
                return false
            }
            window.location = BASE_URL + '/office/health/exportZip?token=' + Cookies.get('token') + '&date=' + date;
        }
    });
</script>
</body>
</html>
